///\todo upgrade

//////////////////////////////////////////////////////////////////////////////////
//                                                                              //
//  This file is part of the buola project (https://code.google.com/p/buola/).  //
//                                                                              //
//  Copyright(c) 2007-2012 Xavi Gratal                                          //
//  gratal AT gmail DOT com                                                     //
//                                                                              //
//  Buola is free software: you can redistribute it and/or modify               //
//  it under the terms of the GNU General Public License as published by        //
//  the Free Software Foundation, either version 3 of the License, or           //
//  (at your option) any later version.                                         //
//                                                                              //
//  Buola is distributed in the hope that it will be useful,                    //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of              //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               //
//  GNU General Public License for more details.                                //
//                                                                              //
//  You should have received a copy of the GNU General Public License           //
//  along with buola.  If not, see <http://www.gnu.org/licenses/>.              //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////

#ifndef _BUOLA_IMAGE_ARITHMETIC_H_
#define _BUOLA_IMAGE_ARITHMETIC_H_

#include <buola/image.h>
#include <buola/image/operator/add.h>
#include <buola/image/operator/base.h>

namespace buola { namespace img {

template<typename tLH,typename tRH>
typename std::enable_if<MIsImageOperand<tLH>::value&&MIsImageOperand<tRH>::value,
                        typename MBinaryOpResult<tLH,tRH,COpAdd>::type>::type
operator+(const tLH &pLH,const tRH &pRH)
{
    typedef MBinaryOpResult<tLH,tRH,COpAdd>::type tResult;
    return tResult(pLH,pRH,COpAdd());
}
    
template<typename tLH,typename tSRH>
typename std::enable_if<MIsImageOperand<tLH>::value&&std::is_arithmetic<tSRH>::value,
                        typename MUnaryOpResult<tLH,COpAddScalar<tSRH>>::type>::type
operator+(const tLH &pLH,const tSRH &pSRH)
{
    typedef MUnaryOpResult<tLH,COpAddScalar<tSRH>>::type tResult;
    return tResult(pLH,COpAddScalar<tSRH>(pSRH));
}
    
template<typename tSLH,typename tRH>
typename std::enable_if<MIsImageOperand<tRH>::value&&std::is_arithmetic<tSLH>::value,
                        typename MUnaryOpResult<tRH,COpAddScalar<tSLH>>::type>::type
operator+(const tSLH &pSLH,const tRH &pRH)
{
    typedef MUnaryOpResult<tRH,COpAddScalar<tSLH>>::type tResult;
    return tResult(pRH,COpAddScalar<tSLH>(pSLH));
}
    
    
/*namespace image*/ } /*namespace buola*/ }

#endif
